package cn.kow.kmall.system.service.impl;

import cn.kow.kmall.system.entity.SysRole;
import cn.kow.kmall.admin.pojo.dto.RoleQueryDTO;
import cn.kow.kmall.system.repository.SysRoleRepository;
import cn.kow.kmall.system.service.SysRoleService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service;

/**
 * @Author: lijun
 * @Description:
 * @Date: Created in 2019-10-29 18:27
 * @Modified By:
 */
@Slf4j
@Service("sysRoleService")
public class SysRoleServiceImpl implements SysRoleService {

    @Autowired
    private SysRoleRepository sysRoleRepository;

    @Override
    public void save(SysRole sysRole) {
        sysRoleRepository.create(sysRole);
    }

    @Override
    public void remove(Long id) {
        sysRoleRepository.deleteById(id);
    }

    @Override
    public void update(SysRole sysRole) {
        sysRoleRepository.update(sysRole);
    }

    @Override
    public SysRole getById(Long id) {
        return sysRoleRepository.getById(id);
    }

    @Override
    public Page<SysRole> listByPage(RoleQueryDTO queryDTO) {
        return sysRoleRepository.queryByPage(queryDTO);
    }
}
